/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ih_base_platform;

import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JLabel;
import net.java.balloontip.BalloonTip;
import net.java.balloontip.styles.BalloonTipStyle;
import net.java.balloontip.styles.ModernBalloonStyle;
import net.java.balloontip.utils.FadingUtils;
import net.java.balloontip.utils.TimingUtils;

/**
 *
 * @author Melvin
 */
public class ErrorEntity {

    /**
     * Muestra un mensaje de error sobre el componente de interfaz grafica
     * indicado
     *
     * @param element JComponent
     * @param error Mensaje de Error
     */
    static void messageUp(JComponent element, String error) {

        Color color = new java.awt.Color(204, 204, 204);
        BalloonTipStyle look = new ModernBalloonStyle(0, 0, color, color, color);
        BalloonTip myBalloonTip = new BalloonTip(element, error, look, false);
        myBalloonTip.setPadding(3);
        TimingUtils.showTimedBalloon(myBalloonTip, 4000);
        FadingUtils.fadeInBalloon(myBalloonTip, null, 600, 30);
    }

    /**
     * Muestra un mensaje de error debajo del componente de interfaz grafica
     * indicado
     *
     * @param element
     * @param error
     */
    static void messageDown(JComponent element, String error,BalloonTip.AttachLocation location) {
        
        Color color = new java.awt.Color(204, 204, 204);
        BalloonTipStyle look = new ModernBalloonStyle(0, 0, color, color,
                color);

        BalloonTip myBalloonTip = new BalloonTip(element,
                new JLabel(error), look,BalloonTip.Orientation.LEFT_BELOW,location, 10, 8,
                false);

        myBalloonTip.setPadding(3);
        TimingUtils.showTimedBalloon(myBalloonTip, 4000);
        FadingUtils.fadeInBalloon(myBalloonTip, null, 600, 30);
    }
}
